#include "utils.h"
#include <algorithm>
#include <cstddef>
#include <iostream>
#include <iterator>
#include <vector>
bool all_pos(vector<int> &a) {
  return all_of(a.begin(), a.end(), [](int i) { return i > 0; });
}
bool all_event(vector<int> &a) {
  return all_of(a.begin(), a.end(), [](int i) { return i % 2 == 0; });
}
bool any_pos(vector<int> &a) {
  return any_of(a.begin(), a.end(), [](int i) { return i > 5; });
}
bool none_neg(vector<int> &a) {
  return none_of(a.begin(), a.end(), [](int i) { return i < 0; });
}
vector<int> double_elem(vector<int> &a) {
  vector<int> b;
  for_each(a.begin(), a.end(), [&b](int &i) { b.push_back(i * 2); });
  return b;
}
void show_vec(vector<int> &a) {
  for (auto e : a)
    std::cout << e << " ";
  std::cout << std::endl;
}
bool find_elem(vector<int> &a, int num) {
  vector<int>::iterator it = find(a.begin(), a.end(), num);
  if (it != a.end())
    return true;
  else
    return false;
}
vector<int>::iterator find_event(vector<int> &a) {
  return find_if(a.begin(), a.end(), [](int a) { return a % 2 == 0; });
}
vector<int>::iterator find_odd(vector<int> &a) {
  return find_if_not(a.begin(), a.end(), [](int a) { return a % 2 == 0; });
}
vector<int>::iterator find_vec(vector<int> &a, vector<int> &b) {
  vector<int>::iterator it =
      std::find_end(a.begin(), a.end(), b.begin(), b.end());
  return it;
}
vector<int>::iterator find_first_elem(vector<int> &a, vector<int> &b) {
  return std::find_first_of(a.begin(), a.end(), b.begin(), b.end(),
                            [](int i, int j) { return i > j; });
}
vector<int>::iterator find_two_elem(vector<int> &a) {
  return std::adjacent_find(a.begin(), a.end());
}
int even_num(vector<int> &a) {
  return count_if(a.begin(), a.end(), [](int i) { return i % 2 == 0; });
}
int num_count(vector<int> &a, int b) { return count(a.begin(), a.end(), b); }
pair<vector<int>::iterator, vector<int>::iterator> match_num(vector<int> &a,
                                                             vector<int> &b) {
  return std::mismatch(a.begin(), a.end(), b.begin());
}
vector<int>::iterator copy_vector(vector<int> &a, vector<int> &b) {
  vector<int>::iterator it;
  copy(a.begin(), a.end(), b.begin());
  return b.begin();
}
void copy_nelem(vector<int>&a,vector<int>&b,int nums){
    copy_n(a.begin(),nums,b.begin());
}
void copy_even(vector<int>&a,vector<int>&b){
    copy_if(a.begin(),a.end(),b.begin(),[](int i){return i%2 == 0;});
}
void mv_even(vector<int>&a,vector<int>&b){
    std::move(a.begin(), a.end(), b.begin());
}
vector<int> time_num(vector<int>& num,int a){
    vector<int> result = vector<int>(num.size(),0);
    transform(num.begin(),num.end(),result.begin(),[&a](int i){return a*i;});
    return result;
}
vector<int> init_vector(int s,int num){
    vector<int> result = vector<int>(s);
    fill(result.begin(),result.end(),num);
    return result;
}
vector<int> range(int n){
    vector<int> result = vector<int>(n);
    int init = 0;
    generate(result.begin(),result.end(),[&init](){return init++;});
    return result;
}